def quick_sort(array, start=None, end=None):
    def partition(array, start, end):
        k = start
        x = array[k]
        array[k], array[end - 1] = array[end - 1], array[k]
        i = start - 1
        for j in range(start, end):
            if array[j] < x:
                i += 1
                array[i], array[j] = array[j], array[i]
        i += 1
        array[i], array[end - 1] = array[end - 1], array[i]
        return i

    if start is None:
        start = 0
    if end is None:
        end = len(array)

    if start < end:
        q = partition(array, start, end)
        quick_sort(array, start, q)
        quick_sort(array, q + 1, end)
